aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/redeem/[redeemcode]/+server.js
blob: b99d9abe2477789499268574d71bd28424578fdf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { error, redirect } from '@sveltejs/kit';
import { auth, post } from '$lib/utils';

export async function GET({ cookies, locals, params }) {
	let { user } = locals;

	if (user) {
    await post('/redeem', params, auth(cookies));
    throw redirect(307, `/${user.username}/transactions`);
  } 

	throw redirect(307, '/login');
}